<%@ page import="java.sql.Connection" %><%--
  Created by IntelliJ IDEA.
  User: wenze-zero
  Date: 2021-06-08-008
  Time: 下午 07:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.*" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    String id=request.getParameter("id");
    String name=request.getParameter("username");
    String password=request.getParameter("password");
    Class.forName ("com.mysql.jdbc.Driver");
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test?serverTimezone=Asia/Shanghai", "root", "20010812");
    out.println("数据库链接成功"+"<br>");
    Statement stm=conn.createStatement();
    String sql="insert into student values('"+id+"','"+name+"','"+password+"')";
    out.println(sql);
    int i=stm.executeUpdate(sql);
    out.println("插入"+i+"条成功！");
    stm.close();
    conn.close();
%>
</body>
</html>
